#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const bzipConfig = require('./.bzip.config.js')
const { exec } = require('child_process')

const FILE_NAME = bzipConfig.openFileName

function main() {
  const projectRoot = process.cwd();
  const filePath = path.join(projectRoot, FILE_NAME);
  if (!fs.existsSync(filePath)) {
    console.error(`文件不存在: ${filePath}`);
    return;
  }
  const command = `explorer /select, "${filePath}"`;
  exec(command, () => {
    console.log(`已成功在文件资源管理器中打开并选中文件: ${filePath}`);
  });
}

main();
